<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.laputa.model.Ground"%>
<%@page import="com.laputa.service.model.ShowGroundData"%>
<%@page import="com.laputa.service.model.MainFrameData"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
	<%
		ShowGroundData data = (ShowGroundData) request.getAttribute("showGroundData");
		Ground ground = data.getGround();
		request.setAttribute("groundID", ground.getId());
		String currentUserName = ((MainFrameData) request.getSession().getAttribute("userData")).getName();
		request.setAttribute("currentUserName", currentUserName);
		System.out.println("from showGround.jsp, currusername = " + currentUserName);
	 %>

	<head>
		<base href="<%=basePath%>">
		<title>This is ground ${groundID}</title>
		<link rel="stylesheet" type="text/css" href="default/default.css">
	</head>
	
	<body>
		这块地属于 <%= ground.getOwner() %> <br/>
		这块地当前被租用给 <%= ground.getUser() %> <br/>
		这块地上面的建筑物是 <%= ground.getBuilding() %> <br/>
		这块地的ID是 <%= ground.getId() %> <br/>
		${resultMessage}
		<form method="post" action="buy.do">
			<input type="hidden" name="groundID" value="${groundID}"/>
			<input type="submit" name="buy" value="购买这个建筑物"/>
		</form>

		<logic:equal name="currentUserName" value="<%=ground.getUser()%>">
			<form method="post" action="build.do">
				<input type="hidden" name="groundID" value="${groundID}"/>
				<input type="hidden" name="buildingType" value=""/>
				<input type="submit" name="build" value="在这块土地上盖楼"/>
			</form>
		</logic:equal>
		
	<form method="post" action="login.do">
	 	<input type="submit" name="home" value="返回" />
	 </form>
		
	</body>
</html>
